package com.capgemini.poste.dao;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;


/**
 * The persistent class for the affectation database table.
 * 
 */
@Entity
@Table(name="affectation")
public class Affectation implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique=true, nullable=false)
	private int id;

	@Temporal(TemporalType.DATE)
	private Date dt;

	@Column(name="poste_cd", nullable=false, length=20)
	private String posteCd;

	@Column(name="user_cd", nullable=false, length=8)
	private String userCd;

	public Affectation() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDt() {
		return this.dt;
	}

	public void setDt(Date dt) {
		this.dt = dt;
	}

	public String getPosteCd() {
		return this.posteCd;
	}

	public void setPosteCd(String posteCd) {
		this.posteCd = posteCd;
	}

	public String getUserCd() {
		return this.userCd;
	}

	public void setUserCd(String userCd) {
		this.userCd = userCd;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((posteCd == null) ? 0 : posteCd.hashCode());
		result = prime * result + ((userCd == null) ? 0 : userCd.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Affectation other = (Affectation) obj;
		if (posteCd == null) {
			if (other.posteCd != null)
				return false;
		} else if (!posteCd.equals(other.posteCd))
			return false;
		if (userCd == null) {
			if (other.userCd != null)
				return false;
		} else if (!userCd.equals(other.userCd))
			return false;
		return true;
	}

}